<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>帐号安全</title>
		<link rel="stylesheet" href="../css/mui.min.css" />
		<link href="../css/mui.picker.css" rel="stylesheet" />
		<link href="../css/mui.poppicker.css" rel="stylesheet" />
		<!--<link rel="stylesheet" type="text/css" href="../css/mui.picker.min.css" />-->
	</head>
	<style>
		.headbar {
			background-color: #3ac9af;
		}
		
		.mui-icon-left-nav {
			color: white;
		}
		
		.mui-title {
			color: white;
		}
		
		.list {
			margin-top: 10px;
			background-color: white;
			padding: 0px 0px 0px 10px;
		}
		
		.list .item {
			background-color: white;
			height: 50px;
		}
		
		.list .item.bottom {
			border-bottom: 1px solid #d5d5d5;
		}
		
		.item .itemname {
			float: left;
			margin-top: 15px;
			margin-left: 10px;
			color: #555555;
		}
		
		.item .itemvalue {
			float: right;
			margin-top: 15px;
			margin-right: 15px;
			color: #555555;
		}
		
		.item .itemimg img {
			float: right;
			margin-top: 2px;
			margin-right: 20px;
			height: 45px;
			width: 45px;
			border-radius: 23px;
		}
		
		.navigate-right:after {
			float: right;
			content: '\e583';
			margin-top: 15px;
			margin-right: 10px;
			;
			font-size: 25px;
			font-family: Muiicons;
			color: #c5c5c5;
		}
	</style>

	<body>
		<header class="mui-bar mui-bar-nav headbar">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">帐号安全</h1>
		</header>
		<div class="mui-content">
			<div class="list">
				<div class="item setpassword"><span class="itemname">修改密码</span><span class="navigate-right"></span></div>
				<div class="item setmobile"><span class="itemname">手机号码</span><span id="mobile" class="itemvalue"></span></div>
			</div>
		</div>
	</body>
	<script type="text/javascript" src="../js/mui.min.js"></script>
	<script src="../script/config.js"></script>
	<script src="../script/moocpublic.js"></script>
	<script src="../js/DMobileFrame_DownLoadUtil.js"></script>
	<script>
		var localStorageManagers = require("script/localStorageManagers.js");
		var downloadUtils = require('scripts/Core/DownLoadUtil.js');
		var mobileFrame = require('scripts/Core/MobileFrame.js');
		//mui初始化
		mui.init({
			swipeBack: true
		});
		//plus初始化
		mui.plusReady(plusReady);
		//plusReady
		function plusReady() {
			//手机号值
			loadMobile();
			//设置密码
			mui('.mui-content').on('tap', '.setpassword', function() {
				mui.openWindow({
					url: 'updatepassword.html',
					id: 'setup/updatepassword'
				});
			});
			//设置手机号
			mui('.mui-content').on('tap', '.setmobile', function() {
				mui.openWindow({
					url: 'updatemobile.html',
					id: 'setup/updatemobile'
				});
			});
		};
		//加载手机号
		function loadMobile() {
			if(hasNet()){
				loadAjax();
			}else{
				loadLocal();
			}
		}
		//是否有网
		function hasNet() {
			var isNet = mobileFrame.IsNetWorkCanUse();
			return isNet;
		}
		//ajax加载
		function loadAjax(){
			var userid=localStorageManagers.getUseridSession();
			var url=serverAjax+'mobile/user/getUser.do';
			mui.ajax(url,{
				data:{userid:userid},
				type:'post',
				dataType:'json',
				timeout:10000,
				success:function(data){
					if(data==null||data.length==0)return;
					var userinfo=data.ext1;
					localStorageManagers.setUserinfoSession(userinfo);
					//userinfo=JSON.parse(userinfo);
					var mobile=data.mobileTelNumber;
					setMobile(mobile);
					//document.getElementById('mobile').innerHTML=userinfo.telephone;
				},
				error:function(e1,e2,e3){
					console.log(e1);
					ajaxErrorTip();
				}
			});
		}
		//本地加载
		function loadLocal(){
			var userinfo=localStorageManagers.getUserinfoSession();
			document.getElementById('mobile').innerHTML=userinfo.telephone;
		}
		//设置手机号
		function setMobile(mobile){
			document.getElementById('mobile').innerHTML=mobile;
		}
		
	</script>

</html>